<%@ page import="com.party.core.model.system.TargetType" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>编辑人员信息</title>
    <%@include file="../include/commonFile.jsp" %>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/ui/system/member/member_form.css">
    <style type="text/css">
        .aui-field-title {
            border: none;
            border-top: 1px solid #e2e2e2;
            text-align: center;
            margin: 15px 30px 0px;
        }

        .aui-field-title legend {
            padding: 0px 10px;
        }

        .layui-input, .layui-textarea {
            width: 80% !important;
        }

        .layui-unselect {
            width: 100% !important;
        }

        .layui-form-radio {
            width: auto !important;
        }

        .w-100 {
            width: 100% !important;
        }

        .label-special {
            width: 20px !important;
            height: 38px !important;
            line-height: 32px !important;
        }

        .label-special-two {
            padding-left: 0px;
            width: 60px !important;
        }

        .selected-option {
            position: relative;
            top: 9px;
        }
    </style>
</head>
<body>
<!--头部-->
<%@include file="../include/header.jsp" %>
<script type="text/html" id="apply_template">
    <div class="go-info-{{ d.index }}">
        <div class="layui-form-item">
            <div class="layui-input-inline">
                <p class="layui-form-label" style="font-size: 16px;font-weight: bold;">
                    {{# if(d.index == 1){ }}
                    第二段行程
                    {{# } }}
                </p>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">出行方式<span class="f-verify-red">*</span></label>
            <div class="layui-input-block">
                <input class="layui-input" lay-verify="required" name="goItineraries[{{ d.index }}].travelType"
                       placeholder="飞机、火车、汽车、其他。"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">出发班次<span class="f-verify-red">*</span></label>
            <div class="layui-input-block">
                <input class="layui-input" lay-verify="required" name="goItineraries[{{ d.index }}].travelNumber"
                       placeholder="出发航班/列车编号"/>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">出发城市</label>
                <div class="layui-input-inline">
                    <input class="layui-input w-100"
                           name="goItineraries[{{ d.index }}].departCity"/>
                </div>
                <div class="layui-input-inline label-special">→</div>
                <label class="layui-form-label label-special-two">到达城市</label>
                <div class="layui-input-inline">
                    <input class="layui-input w-100"
                           name="goItineraries[{{ d.index }}].arrivalCity"/>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">出发站点</label>
                <div class="layui-input-inline">
                    <input class="layui-input w-100"
                           name="goItineraries[{{ d.index }}].departStation"/>
                </div>
                <div class="layui-input-inline label-special">→</div>
                <label class="layui-form-label label-special-two">到达站点<span class="f-verify-red">*</span></label>
                <div class="layui-input-inline">
                    <input class="layui-input w-100" lay-verify="required"
                           name="goItineraries[{{ d.index }}].arrivalStation"/>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">出发时间</label>
                <div class="layui-input-inline">
                    <input id="go-date-depart-{{ d.index }}" class="layui-input chufa-time w-100"
                           name="goItineraries[{{ d.index }}].departDate"
                           lay-verify="" readonly
                    />
                </div>
                <div class="layui-input-inline label-special">→</div>
                <label class="layui-form-label label-special-two">到达时间<span class="f-verify-red">*</span></label>
                <div class="layui-input-inline">
                    <input id="go-date-arrival-{{ d.index }}" class="layui-input chufa-time w-100"
                           name="goItineraries[{{ d.index }}].arrivalDate"
                           readonly
                           lay-verify="required|arrivalTime"/>
                </div>
            </div>
        </div>
    </div>
</script>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">

            <!-- 正文请写在这里 -->
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <li class="layui-this"><span class="title f18 ml5 mr5">个人信息编辑</span></li>
                    <li><span class="title f18 ml5 mr5">保险信息编辑</span></li>
                    <li><span class="title f18 ml5 mr5">行程信息编辑</span></li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <form id="baseForm" class="layui-form mt20" method="post"
                              action="${ctx}/gatherInfo/member/saveBaseInfo.do">
                            <input type="hidden" name="gMemberId" value="${memberInfo.id}"/>
                            <input type="hidden" name="id" value="${member.id}"/>

                            <fieldset class="aui-field-title">
                                <legend>个人信息<b class="pl5 pr5">·</b>基本信息</legend>
                            </fieldset>
                            <div class="layui-form-item">
                                <label class="layui-form-label">姓&emsp;&emsp;名</label>
                                <div class="layui-input-block">
                                    <input class="layui-input" name="fullname"
                                           value='${empty member.fullname ? member.realname : member.fullname}' ${ member.isCertified == 1 ? 'disabled': ''}/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">头&emsp;&emsp;像</label>
                                <div class="cover-content">
                                    <input type="hidden" name="logo" id="pic" lay-verify="pic" value="${member.logo}"/>
                                    <c:if test="${member == null || empty member.logo}">
                                        <span id="cover-img" class="round-img"
                                              style='background-image: url("${ctx}/image/avatar1.png")'></span>
                                    </c:if>
                                    <c:if test="${member != null || not empty member.logo}">
                                        <span id="cover-img" class="round-img"
                                              style='background-image: url("${member.logo}")'></span>
                                    </c:if>
                                    <a class="layui-btn layui-btn-danger" id="sel_pic_img">+添加图片</a>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">性&emsp;&emsp;别</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="sex" lay-filter="sex" id="male" value="1" title="男"
                                    ${member == null || member.sex == "1" ? 'checked="checked"' : ''}
                                    ${ member.isCertified == 1 ? 'disabled': ''}>
                                    <input type="radio" name="sex" lay-filter="sex" id="female" value="0" title="女"
                                    ${member != null && member.sex == "0" ? 'checked="checked"' : ''}
                                    ${ member.isCertified == 1 ? 'disabled': ''}>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">公&emsp;&emsp;司</label>
                                <div class="layui-input-block">
                                    <input class="layui-input" name="company" value='${member.company}'/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">职&emsp;&emsp;务</label>
                                <div class="layui-input-block">
                                    <input class="layui-input" name="jobTitle" value='${member.jobTitle}'/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">手&emsp;&emsp;机</label>
                                <div class="layui-input-block">
                                    <input class="layui-input" name="mobile" lay-verify="mobile"
                                           value='${member.mobile}' ${empty member.mobile ? '' : 'readonly="readonly"'} />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">微&emsp;&emsp;信</label>
                                <div class="layui-input-block">
                                    <input class="layui-input" name="wechatNum" value='${member.wechatNum}'/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">地&emsp;&emsp;区</label>
                                    <div class="layui-input-inline">
                                        <select lay-filter="province">
                                            <option value="">选择省份/直辖市</option>
                                            <c:forEach var="area" items="${areas}">
                                                <option value="${area.id}" ${arParent == area.id?'selected="selected"' : ''}>${area.name}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <div class="layui-input-inline">
                                        <select name="city" id="city">
                                            <option value="">选择城市</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">行&emsp;&emsp;业</label>
                                    <div class="layui-input-inline">
                                        <select lay-filter="industry">
                                            <option value="">选择行业分类</option>
                                            <c:forEach var="industry" items="${industries}">
                                                <option value="${industry.id}" ${inParent == industry.id?'selected="selected"' : ''}>${industry.name}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <div class="layui-input-inline">
                                        <select name="industry" id="industry">
                                            <option value="">选择行业</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <%--<div class="layui-form-item">
                                <label class="layui-form-label">自我介绍</label>
                                <div class="layui-input-block">
                                    <textarea name="signature" placeholder="用一两句话来让别人更全面的认识您"
                                              class="layui-textarea">${member.signature}</textarea>
                                </div>
                            </div>--%>
                            <div class="layui-form-item">
                                <label class="layui-form-label">组内职务</label>
                                <div class="layui-input-block">
                                    <input class="layui-input" name="groupJobTitle"
                                           value='${memberInfo.groupJobTitle}'/>
                                </div>
                            </div>
                            <fieldset class="aui-field-title">
                                <legend>个人信息<b class="pl5 pr5">·</b>健康信息</legend>
                            </fieldset>
                            <div class="layui-form-item">
                                <label class="layui-form-label">过&emsp;&emsp;敏<span class="f-verify-red">*</span></label>
                                <div class="layui-input-block">
                                    <input type="radio" name="isGm" lay-verify="radioRequired" lay-filter="radioRequired" value="1" title="是" ${mInfo.isGm == 1 ? 'checked="checked"' : ''} />
                                    <input type="radio" name="isGm" lay-filter="radioRequired" value="0" title="否" ${mInfo.isGm == 0 ? 'checked="checked"' : ''} />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">贫&emsp;&emsp;血<span class="f-verify-red">*</span></label>
                                <div class="layui-input-block">
                                    <input type="radio" name="isPx" lay-verify="radioRequired" lay-filter="radioRequired" value="1" title="是" ${mInfo.isPx == 1 ? 'checked="checked"' : ''} />
                                    <input type="radio" name="isPx" lay-filter="radioRequired" value="0" title="否" ${mInfo.isPx == 0 ? 'checked="checked"' : ''} />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">癫&emsp;&emsp;痫<span class="f-verify-red">*</span></label>
                                <div class="layui-input-block">
                                    <input type="radio" name="isDx" lay-verify="radioRequired" lay-filter="radioRequired" value="1" title="是" ${mInfo.isDx == 1 ? 'checked="checked"' : ''} />
                                    <input type="radio" name="isDx" lay-filter="radioRequired" value="0" title="否" ${mInfo.isDx == 0 ? 'checked="checked"' : ''} />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">孕&emsp;&emsp;妇<span class="f-verify-red">*</span></label>
                                <div class="layui-input-block">
                                    <input type="radio" name="isYf" lay-verify="radioRequired" lay-filter="radioRequired" value="1" title="是" ${mInfo.isYf == 1 ? 'checked="checked"' : ''} />
                                    <input type="radio" name="isYf" lay-filter="radioRequired" value="0" title="否" ${mInfo.isYf == 0 ? 'checked="checked"' : ''} />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">低&ensp;血&ensp;糖<span class="f-verify-red">*</span></label>
                                <div class="layui-input-block">
                                    <input type="radio" name="isDxt" lay-verify="radioRequired" lay-filter="radioRequired" value="1" title="是" ${mInfo.isDxt == 1 ? 'checked="checked"' : ''} />
                                    <input type="radio" name="isDxt" lay-filter="radioRequired" value="0" title="否" ${mInfo.isDxt == 0 ? 'checked="checked"' : ''} />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">高&ensp;血&ensp;压<span class="f-verify-red">*</span></label>
                                <div class="layui-input-block">
                                    <input type="radio" name="isGxy" lay-verify="radioRequired" lay-filter="radioRequired" value="1" title="是" ${mInfo.isGxy == 1 ? 'checked="checked"' : ''} />
                                    <input type="radio" name="isGxy" lay-filter="radioRequired" value="0" title="否" ${mInfo.isGxy == 0 ? 'checked="checked"' : ''} />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">心&ensp;脏&ensp;病<span class="f-verify-red">*</span></label>
                                <div class="layui-input-block">
                                    <input type="radio" name="isXzb" lay-verify="radioRequired" lay-filter="radioRequired" value="1" title="是" ${mInfo.isXzb == 1 ? 'checked="checked"' : ''} />
                                    <input type="radio" name="isXzb" lay-filter="radioRequired" value="0" title="否" ${mInfo.isXzb == 0 ? 'checked="checked"' : ''} />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">心肌缺氧<span class="f-verify-red">*</span></label>
                                <div class="layui-input-block">
                                    <input type="radio" name="isXjqy" lay-verify="radioRequired" lay-filter="radioRequired" value="1" title="是" ${mInfo.isXjqy == 1 ? 'checked="checked"' : ''} />
                                    <input type="radio" name="isXjqy" lay-filter="radioRequired" value="0" title="否" ${mInfo.isXjqy == 0 ? 'checked="checked"' : ''} />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">骨关节疾病<span class="f-verify-red">*</span></label>
                                <div class="layui-input-block">
                                    <input type="radio" name="isGgj" lay-verify="radioRequired" lay-filter="radioRequired" value="1" title="是" ${mInfo.isGgj == 1 ? 'checked="checked"' : ''} />
                                    <input type="radio" name="isGgj" lay-filter="radioRequired" value="0" title="否" ${mInfo.isGgj == 0 ? 'checked="checked"' : ''} />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">健康信息</label>
                                <div class="layui-input-block">
                                    <textarea name="healthInfo" placeholder="健康信息" class="layui-textarea">${mInfo.healthInfo}</textarea>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <a href="javascript:void(0)" class="layui-btn layui-btn-danger" lay-submit
                                       lay-filter="baseForm">立即提交</a>
                                    <c:if test="${not empty project.id && empty group.id}">
                                        <a href="javascript:history.back();" class="layui-btn layui-btn-primary">取消</a>
                                    </c:if>
                                    <c:if test="${not empty group.id}">
                                        <a href="javascript:history.back();" class="layui-btn layui-btn-primary">取消</a>
                                    </c:if>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="layui-tab-item">
                        <form id="insuranceForm" class="layui-form mt20" method="post"
                              action="${ctx}/gatherInfo/member/saveInsuranceInfo.do">
                            <input type="hidden" name="id" value="${mInfo.id}"/>
                            <input type="hidden" name="memberId" value="${member.id}"/>
                            <input type="hidden" name="gatherInfoMemberId" value="${memberInfo.id}"/>
                            <input type="hidden" id="iscertified" value="${member.isCertified}"/>
                            <input type="hidden" id="carValue"  value="${mInfo.idCard}"/>
                            <input type="hidden" id="taiValue"  value="${mInfo.taiwanCertificate}"/>
                            <input type="hidden" id="returnValue"  value="${mInfo.returnCard}"/>
                            <input type="hidden" id="passValue"  value="${mInfo.passport}"/>
                            <fieldset class="aui-field-title">
                                <legend>保险信息<b class="pl5 pr5">·</b>个人信息</legend>
                            </fieldset>

                            <div class="layui-form-item" >
                                <div class="layui-form-label">
                                    <select name="useCertificate" id="useCertificate" lay-filter="switchSupportRange">
                                        <option value="0" ${ empty mInfo.id ||  mInfo.useCertificate == 0 ? 'selected': ''}>&nbsp;&nbsp;身份证</option>
                                        <option value="1" ${not empty mInfo.id && mInfo.useCertificate == 1 ? 'selected': ''}>&nbsp;&nbsp;台胞证</option>
                                        <option value="2" ${not empty mInfo.id && mInfo.useCertificate == 2 ? 'selected': ''}>&nbsp;&nbsp;回乡证</option>
                                        <option value="3" ${not empty mInfo.id && mInfo.useCertificate == 3 ? 'selected': ''}>&nbsp;&nbsp;&nbsp;护照</option>
                                    </select>
                                </div>

                                <div class="aui-list-item-input">

                                    <c:if test="${empty  mInfo.useCertificate  || mInfo.useCertificate == 0}">
                                        <div class="layui-input-block range-id selected-option " ${mInfo.useCertificate == 0 || empty mInfo.useCertificate ? '' : 'style="display:none"'}>
                                            <input type="text" placeholder="请输入身份证" style="width: 80% !important;" name="idCard"
                                                   lay-verify="idCard" class="layui-input"
                                                   value="${mInfo.idCard}" ${ member.isCertified == 1 ? 'disabled': ''} id="card_inp"  />
                                        </div>
                                    </c:if>
                                    <c:if test="${ mInfo.useCertificate == 1 }">
                                        <div class="layui-input-block range-tai selected-option " ${mInfo.useCertificate == 1 ? '' : 'style="display:none"'} >
                                            <input type="text" placeholder="请输入台胞证" style="width: 80% !important;"
                                                   name="taiwanCertificate" lay-verify="taiwanCertificate" class="layui-input"
                                                   value="${mInfo.taiwanCertificate}" id="card_inp"/>
                                        </div>
                                    </c:if>
                                    <c:if test="${ mInfo.useCertificate == 2 }">
                                        <div class="layui-input-block range-return selected-option " ${mInfo.useCertificate == 2 ? '' : 'style="display:none"'} >
                                            <input type="text" placeholder="请输入回乡证" style="width: 80% !important;"
                                                   name="returnCard" lay-verify="returnCard" class="layui-input"
                                                   value="${mInfo.returnCard}" id="card_inp"/>
                                        </div>
                                    </c:if>
                                    <c:if test="${ mInfo.useCertificate == 3 }">
                                        <div class="layui-input-block range-pass selected-option " ${mInfo.useCertificate == 3 ? '' : 'style="display:none"'} >
                                            <input type="text" placeholder="请输入护照" style="width: 80% !important;"
                                                   name="passport" lay-verify="passport" class="layui-input"
                                                   value="${mInfo.passport}" id="card_inp"/>
                                        </div>
                                    </c:if>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label">血&emsp;型</label>
                                <div class="layui-input-block">
                                    <input class="layui-input" placeholder="您的血型" name="bloodGroup"
                                           lay-verify="bloodGroup" value='${mInfo.bloodGroup}'/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">病&emsp;史<span class="f-verify-red">*</span></label>
                                <div class="layui-input-block">
                                    <input class="layui-input" placeholder="您的相关病史，没有则填写：无" name="medicalHistory"
                                           lay-verify="medicalHistory" value='${mInfo.medicalHistory}'/>
                                </div>
                            </div>
                            <fieldset class="aui-field-title">
                                <legend>保险信息<b class="pl5 pr5">·</b>紧急联系人</legend>
                            </fieldset>
                            <div class="layui-form-item">
                                <label class="layui-form-label">姓&emsp;名<span class="f-verify-red">*</span></label>
                                <div class="layui-input-block">
                                    <input class="layui-input" placeholder="请输入TA的真实姓名" name="contactName"
                                           lay-verify="contactName" value='${mInfo.contactName}'/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">关&emsp;系<span class="f-verify-red">*</span></label>
                                <div class="layui-input-block">
                                    <input class="layui-input" placeholder="请输入您和TA的真实姓名" name="contactRelation"
                                           lay-verify="contactRelation" value='${mInfo.contactRelation}'/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">手&emsp;机<span class="f-verify-red">*</span></label>
                                <div class="layui-input-block">
                                    <input class="layui-input" placeholder="请输入TA的联系方式" name="contactMobile"
                                           lay-verify="contactMobile" value='${mInfo.contactMobile}'/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <a href="javascript:void(0)" class="layui-btn layui-btn-danger" lay-submit
                                       lay-filter="insuranceForm">立即提交</a>
                                    <c:if test="${not empty project.id && empty group.id}">
                                        <a href="javascript:history.back();" class="layui-btn layui-btn-primary">取消</a>
                                    </c:if>
                                    <c:if test="${not empty group.id}">
                                        <a href="javascript:history.back();" class="layui-btn layui-btn-primary">取消</a>
                                    </c:if>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="layui-tab-item">
                        <form id="itineraryForm" class="layui-form mt20" method="post"
                              action="${ctx}/gatherInfo/member/saveItineraryInfo.do">
                            <input type="hidden" name="id" value="${memberInfo.id}"/>
                            <fieldset class="aui-field-title">
                                <legend>行程信息<b class="pl5 pr5">·</b>去程信息</legend>
                            </fieldset>
                            <div id="go_infos">
                                <c:forEach var="go" items="${memberInfo.goItineraries}" varStatus="st">
                                    <div class="go-info-${st.index}">
                                        <input type="hidden" name="goItineraries[${st.index}].id" value="${go.id}"/>
                                        <div class="layui-form-item">
                                            <div class="layui-input-inline">
                                                <p class="layui-form-label" style="font-size: 16px;font-weight: bold;">
                                                    <c:if test="${st.index == 0}">首段行程</c:if>
                                                    <c:if test="${st.index == 1}">第二段行程</c:if>
                                                </p>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">出行方式<span
                                                    class="f-verify-red">*</span></label>
                                            <div class="layui-input-block">
                                                <input class="layui-input" lay-verify="required"
                                                       name="goItineraries[${st.index}].travelType" autocomplete="true"
                                                       value='${go.travelType}' placeholder="飞机、火车、汽车、其他。"/>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">出发班次<span
                                                    class="f-verify-red">*</span></label>
                                            <div class="layui-input-block">
                                                <input class="layui-input" lay-verify="required"
                                                       name="goItineraries[${st.index}].travelNumber"
                                                       value='${go.travelNumber}' placeholder="出发航班/列车编号"/>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">出发城市</label>
                                                <div class="layui-input-inline">
                                                    <input class="layui-input w-100"
                                                           name="goItineraries[${st.index}].departCity"
                                                           value='${go.departCity}'/>
                                                </div>
                                                <div class="layui-input-inline label-special">→</div>
                                                <label class="layui-form-label label-special-two">到达城市</label>
                                                <div class="layui-input-inline">
                                                    <input class="layui-input w-100"
                                                           name="goItineraries[${st.index}].arrivalCity"
                                                           value='${go.arrivalCity}'/>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">出发站点</label>
                                                <div class="layui-input-inline">
                                                    <input class="layui-input w-100"
                                                           name="goItineraries[${st.index}].departStation"
                                                           value="${go.departStation}"/>
                                                </div>
                                                <div class="layui-input-inline label-special">→</div>
                                                <label class="layui-form-label label-special-two">到达站点<span
                                                        class="f-verify-red">*</span></label>
                                                <div class="layui-input-inline">
                                                    <input class="layui-input w-100" lay-verify="required"
                                                           name="goItineraries[${st.index}].arrivalStation"
                                                           value='${go.arrivalStation}'/>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <div class="layui-inline">
                                                <label class="layui-form-label">出发时间</label>
                                                <div class="layui-input-inline">
                                                    <c:choose>
                                                        <c:when test="${not empty go.departTime}">
                                                            <input id="go-date-depart-${st.index}"
                                                                   class="layui-input chufa-time w-100"
                                                                   name="goItineraries[${st.index}].departDate"
                                                                   lay-verify="" readonly
                                                                   value='<fmt:formatDate value="${go.departTime}" pattern="yyyy-MM-dd HH:mm" />'
                                                            />
                                                        </c:when>
                                                        <c:otherwise>
                                                            <input id="go-date-depart-${st.index}"
                                                                   class="layui-input chufa-time w-100"
                                                                   name="goItineraries[${st.index}].departDate"
                                                                   lay-verify="" readonly
                                                            />
                                                        </c:otherwise>
                                                    </c:choose>
                                                </div>
                                                <div class="layui-input-inline label-special">→</div>
                                                <label class="layui-form-label  label-special-two">到达时间<span
                                                        class="f-verify-red">*</span></label>
                                                <div class="layui-input-inline">
                                                    <c:choose>
                                                        <c:when test="${not empty go.arrivalTime}">
                                                            <input id="go-date-arrival-${st.index}"
                                                                   class="layui-input chufa-time w-100"
                                                                   name="goItineraries[${st.index}].arrivalDate"
                                                                   lay-verify="required|arrivalTime" readonly
                                                                   value='<fmt:formatDate value="${go.arrivalTime}" pattern="yyyy-MM-dd HH:mm" />'
                                                            />
                                                        </c:when>
                                                        <c:otherwise>
                                                            <input id="go-date-arrival-${st.index}"
                                                                   class="layui-input chufa-time w-100"
                                                                   name="goItineraries[${st.index}].arrivalDate"
                                                                   readonly lay-verify="required|arrivalTime"/>
                                                        </c:otherwise>
                                                    </c:choose>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </c:forEach>
                            </div>
                            <div class="layui-form-item" ${fn:length(memberInfo.goItineraries) == 1 ? '' : 'style="display: none"'}>
                                <div class="layui-input-block">
                                    <a href="javascript:void(0);"
                                       class="layui-btn layui-btn-danger addGoBtn layui-btn-sm">
                                        <i class="iconfont icon-add btn-icon"></i> 添加行程
                                    </a>
                                </div>
                            </div>
                            <div class="layui-form-item" ${fn:length(memberInfo.goItineraries) == 2 ? '' : 'style="display: none"'}>
                                <div class="layui-input-block">
                                    <a href="javascript:void(0);"
                                       class="layui-btn layui-btn-danger deleteGoBtn layui-btn-sm" data-index="1">
                                        <i class="iconfont icon-move btn-icon"></i> 删除行程
                                    </a>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">到达是否需要接<span class="f-verify-red">*</span></label>
                                <div class="layui-input-block">
                                    <input type="radio" name="goItineraries[0].isNeedShuttle" value="1" title="是"
                                           lay-verify="required"
                                    ${goFirst == null || goFirst.isNeedShuttle == null || goFirst.isNeedShuttle == 1 ? 'checked="checked"' : ''}
                                    >
                                    <input type="radio" name="goItineraries[0].isNeedShuttle" value="2" title="否"
                                           lay-verify="required"
                                    ${goFirst != null && goFirst.isNeedShuttle == 2 ? 'checked="checked"' : ''}
                                    >
                                </div>
                            </div>
                            <fieldset class="aui-field-title">
                                <legend>行程信息<b class="pl5 pr5">·</b>返程信息</legend>
                            </fieldset>
                            <div class="layui-form-item">
                                <label class="layui-form-label">填写返程信息</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="backItineraries[0].isMustWrite" value="1" title="是"
                                           lay-filter="isMustWrite" lay-verify="required"
                                    ${empty backFirst.isMustWrite || backFirst.isMustWrite == 1 ? 'checked="checked"' : ''}
                                    >
                                    <input type="radio" name="backItineraries[0].isMustWrite" value="2" title="否"
                                           lay-filter="isMustWrite" lay-verify="required"
                                    ${not empty backFirst.isMustWrite && backFirst.isMustWrite == 2 ? 'checked="checked"' : ''}
                                    >
                                </div>
                            </div>
                            <div class="back_infos" ${backFirst.isMustWrite == 2 ? 'style="display:none"' : ''}>
                                <c:forEach var="back" items="${memberInfo.backItineraries}" varStatus="st">
                                    <input type="hidden" name="backItineraries[${st.index}].id" value="${back.id}"/>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">出行方式<span class="f-verify-red">*</span></label>
                                        <div class="layui-input-block">
                                            <input class="layui-input" lay-verify="required"
                                                   name="backItineraries[${st.index}].travelType"
                                                   value='${back.travelType}' placeholder="飞机、火车、汽车、其他。"/>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">出发班次<span class="f-verify-red">*</span></label>
                                        <div class="layui-input-block">
                                            <input class="layui-input" lay-verify="required"
                                                   name="backItineraries[${st.index}].travelNumber"
                                                   value='${back.travelNumber}' placeholder="出发航班/列车编号"/>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">出发城市</label>
                                            <div class="layui-input-inline">
                                                <input class="layui-input w-100"
                                                       name="backItineraries[${st.index}].departCity"
                                                       value='${back.departCity}'/>
                                            </div>
                                            <div class="layui-input-inline label-special">→</div>
                                            <label class="layui-form-label label-special-two">到达城市</label>
                                            <div class="layui-input-inline">
                                                <input class="layui-input w-100"
                                                       name="backItineraries[${st.index}].arrivalCity"
                                                       value='${back.arrivalCity}'/>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">出发站点<span
                                                    class="f-verify-red">*</span></label>
                                            <div class="layui-input-inline">
                                                <input class="layui-input w-100" lay-verify="required"
                                                       name="backItineraries[${st.index}].departStation"
                                                       value="${back.departStation}"/>
                                            </div>
                                            <div class="layui-input-inline label-special">→</div>
                                            <label class="layui-form-label label-special-two">到达站点</label>
                                            <div class="layui-input-inline">
                                                <input class="layui-input w-100"
                                                       name="backItineraries[${st.index}].arrivalStation"
                                                       value='${back.arrivalStation}'/>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">出发时间<span
                                                    class="f-verify-red">*</span></label>
                                            <div class="layui-input-inline">
                                                <c:choose>
                                                    <c:when test="${not empty back.departTime}">
                                                        <input id="back-date-depart-${st.index}"
                                                               class="layui-input chufa-time w-100"
                                                               name="backItineraries[${st.index}].departDate"
                                                               lay-verify="required" readonly
                                                               value='<fmt:formatDate value="${back.departTime}" pattern="yyyy-MM-dd HH:mm" />'
                                                        />
                                                    </c:when>
                                                    <c:otherwise>
                                                        <input id="back-date-depart-${st.index}"
                                                               class="layui-input chufa-time w-100"
                                                               name="backItineraries[${st.index}].departDate"
                                                               lay-verify="required" readonly
                                                        />
                                                    </c:otherwise>
                                                </c:choose>
                                            </div>
                                            <div class="layui-input-inline label-special">→</div>
                                            <label class="layui-form-label  label-special-two">到达时间</label>
                                            <div class="layui-input-inline">
                                                <c:choose>
                                                    <c:when test="${not empty back.arrivalTime}">
                                                        <input id="back-date-arrival-${st.index}"
                                                               class="layui-input chufa-time w-100"
                                                               name="backItineraries[${st.index}].arrivalDate"
                                                               readonly
                                                               lay-verify="arrivalTime"
                                                               value='<fmt:formatDate value="${back.arrivalTime}" pattern="yyyy-MM-dd HH:mm" />'
                                                        />
                                                    </c:when>
                                                    <c:otherwise>
                                                        <input id="back-date-arrival-${st.index}"
                                                               class="layui-input chufa-time w-100"
                                                               name="backItineraries[${st.index}].arrivalDate"
                                                               readonly lay-verify="arrivalTime"/>
                                                    </c:otherwise>
                                                </c:choose>
                                            </div>
                                        </div>
                                    </div>
                                </c:forEach>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">返程是否需要送<span class="f-verify-red">*</span></label>
                                    <div class="layui-input-block">
                                        <input type="radio" name="backItineraries[0].isNeedShuttle" value="1" title="是"
                                               lay-verify="required"
                                        ${backFirst == null || backFirst.isNeedShuttle == null || backFirst.isNeedShuttle == 1 ? 'checked="checked"' : ''}
                                        >
                                        <input type="radio" name="backItineraries[0].isNeedShuttle" value="2" title="否"
                                               lay-verify="required"
                                        ${backFirst != null && backFirst.isNeedShuttle == 2 ? 'checked="checked"' : ''}
                                        >
                                    </div>
                                </div>
                            </div>
                            <fieldset class="aui-field-title">
                                <legend>住宿信息</legend>
                            </fieldset>
                            <div class="layui-form-item">
                                <label class="layui-form-label">官方安排住宿房间类型</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="publicRoomType" value="1" title="单间" lay-verify="roomType"
                                    ${memberInfo.publicRoomType == 1 ? 'checked="checked"' : ''}
                                    >
                                    <input type="radio" name="publicRoomType" value="2" title="标间" lay-verify="roomType"
                                    ${memberInfo.publicRoomType == 2 ? 'checked="checked"' : ''}
                                    >
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">是否需要协助<br/>安排住宿房间类型</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="isNeedArrange" value="1" title="是"
                                           lay-filter="isNeedArrange"
                                    ${not empty memberInfo.isNeedArrange && memberInfo.isNeedArrange == 1 ? 'checked="checked"' : ''}
                                    >
                                    <input type="radio" name="isNeedArrange" value="2" title="否"
                                           lay-filter="isNeedArrange"
                                    ${empty memberInfo.isNeedArrange || memberInfo.isNeedArrange == 2 ? 'checked="checked"' : ''}
                                    >
                                </div>
                            </div>
                            <div id="lodging_info" ${not empty memberInfo.isNeedArrange && memberInfo.isNeedArrange == 1 ? '' : 'style="display:none"'}>
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label">住宿时间0</label>
                                        <div class="layui-input-inline">
                                            <c:choose>
                                                <c:when test="${not empty memberInfo.roomStartTime}">
                                                    <input id="room-start" class="layui-input zhusu-time w-100"
                                                           name="roomStartDate" lay-verify="required"
                                                           readonly
                                                           value="<fmt:formatDate value="${memberInfo.roomStartTime}" pattern="yyyy-MM-dd"/>"
                                                    />
                                                </c:when>
                                                <c:otherwise>
                                                    <input id="room-start" class="layui-input zhusu-time w-100"
                                                           name="roomStartDate" lay-verify="required"
                                                           readonly
                                                    />
                                                </c:otherwise>
                                            </c:choose>
                                        </div>
                                        <div class="layui-input-inline label-special">到</div>
                                        <div class="layui-input-inline">
                                            <c:choose>
                                                <c:when test="${not empty memberInfo.roomEndTime}">
                                                    <input id="room-end" class="layui-input zhusu-time w-100"
                                                           name="roomEndDate" lay-verify="required|roomTime"
                                                           readonly
                                                           value="<fmt:formatDate value="${memberInfo.roomEndTime}" pattern="yyyy-MM-dd"/>"
                                                    />
                                                </c:when>
                                                <c:otherwise>
                                                    <input id="room-end" class="layui-input zhusu-time w-100"
                                                           name="roomEndDate" lay-verify="required|roomTime"
                                                           readonly
                                                    />
                                                </c:otherwise>
                                            </c:choose>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">房间类型</label>
                                    <div class="layui-input-block">
                                        <input type="radio" name="privateRoomType" value="1" title="单间"
                                               lay-verify="privateRoomType"
                                        ${memberInfo.privateRoomType == 1 ? 'checked="checked"' : ''}
                                        >
                                        <input type="radio" name="privateRoomType" value="2" title="标间"
                                               lay-verify="privateRoomType"
                                        ${memberInfo.privateRoomType == 2 ? 'checked="checked"' : ''}
                                        >
                                    </div>
                                </div>
                            </div>
                            <fieldset class="aui-field-title">
                                <legend>备注信息</legend>
                            </fieldset>
                            <div class="layui-form-item">
                                <label class="layui-form-label">备注信息</label>
                                <div class="layui-input-block">
                                    <textarea name="remarks" placeholder="如果您还有什么其它要求，请留下备注信息"
                                              class="layui-textarea">${memberInfo.remarks}</textarea>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <a href="javascript:void(0)" class="layui-btn layui-btn-danger" lay-submit
                                       lay-filter="itineraryForm">立即提交</a>
                                    <c:if test="${not empty project.id && empty group.id}">
                                        <a href="javascript:history.back();" class="layui-btn layui-btn-primary">取消</a>
                                    </c:if>
                                    <c:if test="${not empty group.id}">
                                        <a href="javascript:history.back();" class="layui-btn layui-btn-primary">取消</a>
                                    </c:if>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div><!--底部-->
        <%@include file="../include/footer.jsp" %>
    </section>
</div>
<script type="text/javascript">
    $(function () {
        layui.use(['form', 'laydate', 'element', 'laytpl'], function () {
            var form = layui.form, laydate = layui.laydate, element = layui.element, laytpl = layui.laytpl;

            form.render('select');
            form.render('radio');

            $(".chufa-time").each(function (index, ele) {
                var id = $(ele).attr("id");
                //日期
                var dateopt = {
                    elem: '#' + id,
                    type: 'datetime',
                    format: 'yyyy-MM-dd HH:mm'
                };
                laydate.render(dateopt);
            });

            $(".zhusu-time").each(function (index, ele) {
                var id = $(ele).attr("id");
                //日期
                var dateopt = {
                    elem: '#' + id,
                    type: 'date',
                    format: 'yyyy-MM-dd'
                };
                laydate.render(dateopt);
            })

            element.on('tab', function (data) {
                console.log(this); //当前Tab标题所在的原始DOM元素
                console.log(data.index); //得到当前Tab的所在下标
                console.log(data.elem); //得到当前的Tab大容器
            });

            // 添加行程
            $(".addGoBtn").click(function () {
                var length = $("[class^=go-info]").length;
                var data = {
                    index: length
                };
                var content = $("#go_infos");
                var getTpl = $("#apply_template").html();
                laytpl(getTpl).render(data, function (html) {
                    content.append(html);
                });

                $(".chufa-time").each(function (index, ele) {
                    var id = $(ele).attr("id");
                    //日期
                    var dateopt = {
                        elem: '#' + id,
                        type: 'datetime',
                        format: 'yyyy-MM-dd HH:mm'
                    };
                    laydate.render(dateopt);
                });

                $(this).parent().parent(".layui-form-item").hide();
                $(".deleteGoBtn").parent().parent(".layui-form-item").show();
            });

            // 移除行程
            $(".deleteGoBtn").click(function () {
                var index = $(this).data("index");
                $(".go-info-" + index).remove();
                $(this).parent().parent(".layui-form-item").hide();
                $(".addGoBtn").parent().parent(".layui-form-item").show();
            })

            //自定义验证规则
            form.verify({
                medicalHistory: function (value) {
                    if (value == "") {
                        return '必填项不能为空';
                    }
                },
                contactName: function (value) {
                    if (value == "") {
                        return '必填项不能为空';
                    }
                },
                contactRelation: function (value) {
                    if (value == "") {
                        return '必填项不能为空';
                    }
                },
                mobile: function (value) {
                    if (value != "" && !util.checkMobile(value)) {
                        return '手机号格式不正确';
                    } else if (value != "" && util.checkMobile(value)) {
                        var isRepeat = txz.checkIsUnique('mobile', value, '${member.id}', 1);
                        if (undefined == isRepeat) {
                            return "验证手机号异常";
                        } else if (isRepeat) {
                            return "手机号已存在";
                        }
                    }
                },

                taiwanCertificate: function (value) {
                    console.log(2)
                    var reg = /(^[0-9]{8}$)|(^[0-9]{10}$)/;
                    if (value == "") {
                        return '台胞证不能为空';
                    }
                    if (value != "" && !reg.test(value)) {
                        return '台胞证格式不正确';
                    }
                },
                returnCard: function (value) {
                    var reg = /^[HMhm]{1}([0-9]{10}|[0-9]{8})$/;
                    if (value == "") {
                        return '回乡证不能为空';
                    }
                    if (value != "" && !reg.test(value)) {
                        return '回乡证格式不正确';
                    }
                },
                passport: function (value) {
                    var reg = /^[a-zA-Z0-9]{5,17}$/;
                    if (value == "") {
                        return '护照不能为空';
                    }
                    if (value != "" && !reg.test(value)) {
                        return '护照格式不正确';
                    }
                },

                idCard: function (value) {
                    if (value == "") {
                        return '身份证不能为空';
                    }
                    var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
                    if (value != "" && !reg.test(value)) {
                        return '身份证格式不正确';
                    }
                },
                contactMobile: function (value) {
                    if (value == "") {
                        return '必填项不能为空';
                    }

                    if (value != "" && !util.checkMobile(value)) {
                        return '手机号格式不正确';
                    }
                },
                // 去程到达时间
                arrivalTime: function (value, item) {
                    var departDate = $(item).closest(".layui-form-item").find("[name$=departDate]").val(); // 去程出发时间
                    if (departDate != "") {
                        var gd1 = new Date(departDate.replace(/-/g, "/"));
                        var gd2 = new Date(value.replace(/-/g, "/")); // 去程到达时间
                        if (gd1 >= gd2) {
                            return "到达时间应该晚于出发时间";
                        }
                    }
                },
                roomTime: function (value) {
                    var start = $("[name=roomStartDate]").val();
                    var end = $("[name=roomEndDate]").val();
                    var gd1 = new Date(start.replace(/-/g, "/"));
                    var gd2 = new Date(end.replace(/-/g, "/")); // 去程到达时间
                    if (gd1 > gd2) {
                        return "住宿结束时间应该晚于住宿开始时间";
                    }
                },
                roomType: function (value, ele) {
                    // var roomType = $("[name=" + $(ele).attr("name") + "]:checked").val();
                    // if (roomType == undefined) {
                    //     return "请选择官方安排住宿房间类型";
                    // }
                },
                privateRoomType: function (value, ele) {
                    var isNeedArange = $("[name=isNeedArrange]:checked").val();
                    if (isNeedArange == 1) {
                        var roomType = $("[name=" + $(ele).attr("name") + "]:checked").val();
                        if (roomType == undefined) {
                            return "请选择房间类型";
                        }
                    }
                },
                radioRequired : function (value, ele) {
                    var requiredValue = $("[name=" + $(ele).attr("name") + "]:checked").val();
                    if (requiredValue == undefined) {
                        $(ele).closest(".layui-form-item").find(".layui-form-label").addClass('red');
                        return '请选择';
                    }
                }
            });

            //监听选择证件类型
            form.on('select(switchSupportRange)', function (data) {
                switchSupport = data.value;
                var idCards = $('#carValue').val();
                var isCertified = $('#iscertified').val();
                var taiValue = $('#taiValue').val();
                var returnValue = $('#returnValue').val();
                var passValue = $('#passValue').val();
                if (switchSupport == 0) {
                    $('#card_inp').attr('name', 'idCard');
                    $('#card_inp').attr('placeholder', '请输入身份证');
                    $('#card_inp').attr('lay-verify', 'idCard');
                    if(isCertified == 1){
                        $('#card_inp').attr('disabled', true);
                    }
                    $('#card_inp').val( idCards);
                } else if (switchSupport == 1) {
                    $('#card_inp').attr('name', 'taiwanCertificate');
                    $('#card_inp').attr('placeholder', '请输入台胞证');
                    $('#card_inp').attr('lay-verify', 'taiwanCertificate');
                    $('#card_inp').removeAttr('disabled');
                    $('#card_inp').val( taiValue);
                } else if (switchSupport == 2) {
                    $('#card_inp').attr('name', 'returnCard');
                    $('#card_inp').attr('placeholder', '请输入回乡证');
                    $('#card_inp').attr('lay-verify', 'returnCard');
                    $('#card_inp').removeAttr('disabled');
                    $('#card_inp').val(returnValue);
                }else if (switchSupport == 3) {
                    $('#card_inp').attr('name', 'passport');
                    $('#card_inp').attr('placeholder', '请输入护照');
                    $('#card_inp').attr('lay-verify', 'passport');
                    $('#card_inp').removeAttr('disabled');
                    $('#card_inp').val( passValue);
                }
            });

            form.on('radio(radioRequired)', function (data) {
                $(data.elem).closest(".layui-form-item").find(".layui-form-label").removeClass('red');
            });

            //监听提交 基本信息
            form.on('submit(baseForm)', function (data) {
                txz.submitObject(data.elem, function (callBack) {
                    var action = $("#baseForm").attr("action");
                    $.post(action, $('#baseForm').serialize(), function (res) {
                        typeof callBack === 'function' && callBack();
                        if (res.success) {
                            util.layerMsgSuccess("提交成功", function () {
                                location.reload();
                            });
                        } else {
                            util.layerMsgError(res.description || "提交失败")
                        }
                    });
                });
                return false;
            });

            //监听提交 保险信息
            form.on('submit(insuranceForm)', function (data) {
                txz.submitObject(data.elem, function (callBack) {
                    var action = $("#insuranceForm").attr("action");
                    $.post(action, $('#insuranceForm').serialize(), function (res) {
                        typeof callBack === 'function' && callBack();
                        if (res.success) {
                            util.layerMsgSuccess("提交成功", function () {
                                location.reload();
                            });
                        } else {
                            util.layerMsgError(res.description || "提交失败")
                        }
                    });
                });
                return false;
            });

            //监听提交 行程信息
            form.on('submit(itineraryForm)', function (data) {
                txz.submitObject(data.elem, function (callBack) {
                    var action = $("#itineraryForm").attr("action");
                    $.post(action, $('#itineraryForm').serialize(), function (res) {
                        typeof callBack === 'function' && callBack();
                        if (res.success) {
                            util.layerMsgSuccess("提交成功", function () {
                                if ('${project.id}' != "" && '${group.id}' == "") {
                                    location.href = "${ctx}/gatherInfo/member/list.do?projectId=${project.id}";
                                } else if ('${group.id}' != "") {
                                    location.href = "${ctx}/gatherInfo/member/list.do?pGroupId=${group.id}";
                                }
                            });
                        } else {
                            util.layerMsgError(res.description || "提交失败")
                        }
                    });
                });
                return false;
            });

            // 城市
            form.on('select(province)', function (data) {
                $("#city").html("");
                var cityId = data.value;
                loadCityData(cityId);
            });

            form.on('select(industry)', function (data) {
                $("#industry").html("");
                var industryId = data.value;
                loadIndustryData(industryId);
            });

            var isMustWrite = null;
            form.on('radio(isMustWrite)', function (data) {
                isMustWrite = $(data.elem).val();
                if (isMustWrite == 1) {
                    $(".back_infos").show();
                    addRule('.back_infos');
                } else if (isMustWrite == 2) {
                    $(".back_infos").hide();
                    removeRule('.back_infos');
                }
            });

            var isNeedArrange = null;
            form.on('radio(isNeedArrange)', function (data) {
                isNeedArrange = $(data.elem).val();
                if (isNeedArrange == 1) {
                    $("#lodging_info").show();
                    addRule('#lodging_info');
                } else if (isNeedArrange == 2) {
                    $("#lodging_info").hide();
                    removeRule('#lodging_info');
                }
            });

            if ('${member.city}' != "") {
                loadCityData('${arParent}', '${member.city}');
            }

            if ('${member.industry}' != "") {
                loadIndustryData('${inParent}', '${member.industry}');
            }
            // 填写返程信息
            if ('${backFirst != null && backFirst.isMustWrite != null && backFirst.isMustWrite == 2}' == 'true') {
                removeRule('.back_infos');
            }
            // 住宿信息
            if ('${memberInfo.isNeedArrange == null || memberInfo.isNeedArrange == 2}' == 'true') {
                removeRule('#lodging_info');
            }

            function loadCityData(pCityId, cCityId) {
                $.post("${ctx}/system/member/getCityByParentId.do", {
                    "cityId": pCityId
                }, function (data) {
                    var array = new Array();
                    for (var i = 0; i < data.length; i++) {
                        if (cCityId == data[i].id) {
                            array.push("<option value = '" + data[i].id + "' selected='selected'>" + data[i].name + "</option>");
                        } else {
                            array.push("<option value = '" + data[i].id + "'>" + data[i].name + "</option>");
                        }
                    }
                    $("#city").append(array.join(""));
                    form.render('select');
                });
            }

            function loadIndustryData(pIndustryId, cIndustryId) {
                $.post("${ctx}/system/member/getIndustryByParentId.do", {
                    "industryId": pIndustryId
                }, function (data) {
                    var array = new Array();
                    for (var i = 0; i < data.length; i++) {
                        if (cIndustryId == data[i].id) {
                            array.push("<option value = '" + data[i].id + "' selected='selected' >" + data[i].name + "</option>");
                        } else {
                            array.push("<option value = '" + data[i].id + "'>" + data[i].name + "</option>");
                        }
                    }
                    $("#industry").append(array.join(""));
                    form.render('select');
                });
            }

            function removeRule(container) {
                $(container).find("input").each(function (index, ele) {
                    var verify = $(ele).attr("lay-verify");
                    if (util.isValid(verify) && verify.indexOf("required") != -1) {
                        verify = verify.replace("required", "");
                        verify = verify.replace("|", "");
                        $(ele).attr("lay-verify", verify);
                    }
                })
            }

            function addRule(container) {
                $(container).find("input").each(function (index, ele) {
                    var verify = $(ele).attr("lay-verify");
                    if (!util.isValid(verify)) {
                        verify = "required";
                    } else if (util.isValid(verify)) {
                        verify = "required|" + verify;
                    }
                    $(ele).attr("lay-verify", verify);
                })
            }
        });
        $('#sel_pic_img').click(function () {
            txz.openSelImg({
                min: 1,
                max: 1,
                type: '<%=TargetType.LOGO.getCode()%>',
                cb: function (imgs) {
                    $('#cover-img').css('background-image', 'url(' + imgs[0].path + ')');
                    $('#pic').val(imgs[0].path);
                }
            })
        })
    })
</script>
<script type="text/javascript">
    <c:if test="${not empty project.id && empty group.id}">
    txz.initHeader({
        nav: [{
            name: '项目管理',
            href: '${ctx}/gatherInfo/project/list.do'
        }, {
            name: '${project.title}',
            curr: true
        }, {
            name: '人员管理',
            href: '${ctx}/gatherInfo/member/list.do?projectId=${project.id}'
        }, {
            name: '编辑人员信息',
            curr: true
        }],
        btns: [{
            name: '返回',
            href: '${ctx}/gatherInfo/member/list.do?projectId=${project.id}',
            icon: 'back'
        }]
    });
    </c:if>
    <c:if test="${not empty group.id}">
    txz.initHeader({
        nav: [{
            name: '项目管理',
            href: '${ctx}/gatherInfo/project/list.do'
        }, {
            name: '${project.title}',
            curr: true
        }, {
            name: '${group.groupName}',
            href: '${ctx}/gatherInfo/member/list.do?pGroupId=${group.id}'
        }, {
            name: '人员管理',
            curr: true
        }, {
            name: '编辑人员信息',
            curr: true
        }],
        btns: [{
            name: '返回',
            href: '${ctx}/gatherInfo/member/list.do?pGroupId=${group.id}',
            icon: 'back'
        }]
    });
    </c:if>
</script>
</body>
</html>